package neuron.library.ga;

import neuron.library.ga.common.AbstractFitness;
import neuron.library.ga.common.ChromosomeAbstractFactory;
import neuron.library.ga.common.GMConfiguration;
import neuron.library.ga.crossover.CrossoverStrategy;
import neuron.library.ga.crossover.RandomCrossover;
import neuron.library.ga.crossover.RouletteCrossover;
import neuron.library.ga.mutation.MutationStrategy;
import neuron.library.ga.mutation.NoMutation;
import neuron.library.ga.mutation.RandomLowRateMutation;
import neuron.library.ga.replication.NoReplication;
import neuron.library.ga.replication.RandomLowRateReplication;
import neuron.library.ga.replication.ReplicationStrategy;
import neuron.library.ga.selection.RouletteSelection;
import neuron.library.ga.selection.SelectionStrategy;
import neuron.library.ga.selection.TournamentSelection;
import neuron.library.ga.selection.TruncationSelection;
import neuron.library.ga.tuner.AbstractTuner;
import neuron.library.ga.tuner.NoTuner;

public class SimpleGeneticMachine extends AbstractGeneticMachine {

	public SimpleGeneticMachine(GMConfiguration config,
			ChromosomeAbstractFactory chromosomeFactory, AbstractFitness fitness) {
		super(config, chromosomeFactory, fitness);
	}

	@Override
	protected CrossoverStrategy crossoverFactoryMethod() {
		return new RouletteCrossover(this);
	}

	@Override
	protected SelectionStrategy selectionFactoryMethod() {
		//return new TruncationSelection(this);
		return new RouletteSelection(this);
		//return new TournamentSelection(this);
	}

	@Override
	protected MutationStrategy mutationFactoryMethod() {
		return new NoMutation(this);
	}

	@Override
	protected ReplicationStrategy replicationFactoryMethod() {
		return new NoReplication(this);
	}

	@Override
	protected AbstractTuner tunerFactoryMethod() {
		return new NoTuner(this);
	}

	@Override
	protected boolean stopCondition() {
		if (current_generation >= 100) {
			return true;
		}
		return false;
	}

}
